package com.zzl.bonds.ticket.dto.ticketopen;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.bonds.ticket.constant.type.PaymentModeEnum;
import com.zzl.bonds.ticket.entity.BusinessContractEntity;
import com.zzl.bonds.ticket.entity.TicketCirculationEnterpriseEntity;
import com.zzl.bonds.ticket.entity.TicketDataEntity;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author : spp
 * @date : 2022/2/22 13:39
 */
@Data
@ApidocModel
public class OpenTicketCheckDetailDto {
    /**
     * 凭证信息
     */
    @ApidocModelProperty(description = "主键 uuid/ 业务流水号")
    private String id;
    @ApidocModelProperty(description = "凭证编号")
    private String ticketNo;
    @ApidocModelProperty(description = "处理状态")
    private String handStatus;
    @ApidocModelProperty(description = "处理状态信息悬浮")
    private String handStatusInfo;
    @ApidocModelProperty(description = "处理进度，如25")
    private Integer handProgress;
    @ApidocModelProperty(description = "开单企业名称")
    private String openEnterpriseName;
    @ApidocModelProperty(description = "开单企业统一社会信用代码")
    private String openSocialCreditCode;
    @ApidocModelProperty(description = "收单企业")
    private String receiveEnterpriseName;
    @ApidocModelProperty(description = "收单企业统一社会信用代码")
    private String receiveSocialCreditCode;
    @ApidocModelProperty(description = "授信id")
    private String coreEnterpriseCreditId;
    @ApidocModelProperty(description = "开单额度")
    private String creditUseInfo;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "凭证金额")
    private Double ticketAmount;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "开单日期", validate = "yyyy-MM-dd")
    private Date invoiceTime;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "到期日期", validate = "yyyy-MM-dd")
    private Date expireTime;
    @ApidocModelProperty(description = "备注")
    private String remark;
    private Integer ticketStatus;
    @ApidocModelProperty(description = "凭证状态")
    private String ticketStatusStr;


    /**
     * 应收账款
     */
    @ApidocModelProperty(description = "交易合同号")
    private String contractNo;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "应收账款金额")
    private Double receivableAmount;
    @ApidocModelProperty(description = "企业id,权限使用")
    private String enterpriseId;
    @ApidocModelProperty(description = "创建企业名称")
    private String createEnterpriseName;
    @ApidocModelProperty(description = "剩余天数")
    private String surplusDays;
    /**
     * 文件信息
     */
    @ApidocModelProperty(description = "发票信息")
    List<TicketDataEntity> invoiceList = new ArrayList<>();
    @ApidocModelProperty(description = "贸易合同文件")
    List<TicketDataEntity> proofList = new ArrayList<>();
    @ApidocModelProperty(description = "协议信息")
    List<BusinessContractEntity> protocolList = new ArrayList<>();

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApidocModelProperty(description = "开单时间", validate = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApidocModelProperty(description = "流转企业集合")
    private List<TicketCirculationEnterpriseEntity> circulationEnterpriseList;
    @JsonIgnore
    private Integer paymentMode;
    @ApidocModelProperty(description = "付息方式 ：1 融资方付息（默认）2 核心企业付息")
    private String paymentModeName;

    public String getPaymentModeName() {
        if (null != paymentMode) {
            return PaymentModeEnum.getValue(paymentMode);
        }
        return "";
    }
}
